package com.fankui.servicecms.controller;


import com.fankui.commonutils.R;
import com.fankui.servicecms.entity.CmsBanner;
import com.fankui.servicecms.service.CmsBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author 范奎
 * @since 2023-11-30
 */
@Api(description = "banner前台管理")
@RestController
@RequestMapping("/cmsservice/banner-front")
public class CmsBannerFrontController {
    @Autowired
    private CmsBannerService bannerService;

    @ApiOperation(value = "查询所有banner")
    @Cacheable(value = "banner", key = "'selectIndexList'")
    @GetMapping("findBannerList")
    public R findBannerList() {
        List<CmsBanner> list = bannerService.findBannerList();
        return R.ok().data("items", list);
    }
}

